home *** CD-ROM | disk | FTP | other *** search
- <?php
- ////////////////////////////////////////////////////////////////////////////////
- // <!--Copyright (c) 2005 Pure Networks Inc. All rights reserved.-->
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Build: 3.0.6121.0 (Stable)
- // $Revision: #1 $
- //
- ?>
- <table cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td>
- <div class="DetailsPanel">
- <?php
- $sPath = $sFullFilePath;
- $iDetailsCount = 0;
-
- // Let's get the file's extension so we know which block of code to exexute for the details
- $sExtension = substr(strrchr($sPath, "."), 1);
- switch (strtolower($sExtension))
- {
- case "jpeg":
- case "jpg":
- case "jpe":
- ///////////////////////////////////////////////////
- // Let's find if there is EXIF data and use it if so.
- ///////////////////////////////////////////////////
- $arImgHeaders = exif_read_data($sPath, 'IFD0');
- $arImgHeaders = exif_read_data($sPath, 0, true);
- ///////////////////////////////////////////////////
- // Let's print any header data that we can get a hold of
- // Any that do not exist are not returned and thus not printed
- ///////////////////////////////////////////////////
- imgHeaderDataForDisplay("Camera", imgHeaderData("IFD0", "Model", $arImgHeaders), NULL);
- $strDate = imgHeaderData("EXIF", "DateTimeDigitized", $arImgHeaders);
- if ($strDate != "")
- {
- // replace the :'s between date fields with -'s
- $strDate = sprintf("%04d-%02d-%02d %02d:%02d:%02d", substr($strDate,0,4), substr($strDate,5,2), substr($strDate,8,2), substr($strDate,11,2), substr($strDate,14,2), substr($strDate,17,2));
- // make the string representation of the date a timestamp
- $strDate = strtotime($strDate);
- // format the date if one exists and present it to user
- $strDate = date("M j, Y g:h A", $strDate);
- }
- else
- {
- $strDate = NULL;
- }
- imgHeaderDataForDisplay("Taken", $strDate, NULL);
- imgHeaderDataForDisplay("Size", bytesToHumanReadableUsage(imgHeaderData("FILE", "FileSize", $arImgHeaders),1), NULL);
- imgHeaderDataForDisplay("Width", imgHeaderData("COMPUTED", "Width", $arImgHeaders), "pixels");
- imgHeaderDataForDisplay("Height", imgHeaderData("COMPUTED", "Height", $arImgHeaders), "pixels");
- imgHeaderDataForDisplay("Aperture", imgHeaderData("COMPUTED", "ApertureFNumber", $arImgHeaders), NULL);
- imgHeaderDataForDisplay("Shutter Speed", imgHeaderData("EXIF", "ExposureTime", $arImgHeaders), "sec");
- imgHeaderDataForDisplay("Focal Length", imgHeaderData("EXIF", "FocalLength", $arImgHeaders), NULL);
- break;
- default:
- try
- {
- $nmSharedPlace = $nmNetworkLib->OpenShare($sShare);
- if ($bIsDir)
- {
- imgHeaderDataForDisplay("Type", "Folder", NULL);
- }
- else
- {
- imgHeaderDataForDisplay("Type", $nmSharedPlace->GetFileTypeDescription($sPath), NULL);
- imgHeaderDataForDisplay("Size", bytesToHumanReadableUsage(filesize($sPath),1), NULL);
- }
- }
- catch(Exception $ex)
- {
- log_activity("get details", "exception", $ex->getMessage());
- }
- $strDate = filemtime($sPath);
- if ($strDate != "")
- {
- // format the date if one exists and present it to user
- $strDate = date("M j, Y g:h A", $strDate);
- }
- else
- {
- $strDate = NULL;
- }
- imgHeaderDataForDisplay("Date", $strDate, NULL);
- }
- ///////////////////////////////////////////////////
- // Something funky, no details came back
- ///////////////////////////////////////////////////
- if ($iDetailsCount == 0)
- {
- echo ("No details are available for this file.");
- }
- ?>
- </div>
- </td>
- </tr>
- </table>
- <?php
- ///////////////////////////////////////////////////
- // get the EXIF header data for later display/formatting
- // returns NULL if value does not eixst
- ///////////////////////////////////////////////////
- function imgHeaderData($sKey, $sName, $arImgHeaders)
- {
- if (isset($arImgHeaders[$sKey][$sName]))
- {
- return $arImgHeaders[$sKey][$sName];
- }
- else
- {
- return NULL;
- }
- }
- ///////////////////////////////////////////////////
- // display the formatted EXIF header data in divs
- // only prints if the value passed is NON NULL
- ///////////////////////////////////////////////////
- function imgHeaderDataForDisplay($sTitle, $sValue, $sTextLabel)
- {
- global $iDetailsCount;
- if (isset($sValue))
- {
- echo ("<div class=\"ExifHeaderData\"><span class=\"ExifHeaderTitle\">" . $sTitle . ": </span>");
- echo ($sValue);
- if ($sTextLabel != NULL)
- {
- echo (" " . $sTextLabel);
- }
- echo ("</div>");
- echo ("<div class=\"ExifHR\"><img src=\"/images/pixel.trans.gif\" width=\"1\" height=\"1\" alt=\"\"/></div>");
- $iDetailsCount++;
- }
- }
- ?>